/* eslint-disable import/no-anonymous-default-export */
import { preserve} from '../services/retainedApi'

export default {
    state: {
        data: [],
        retainedSpreadData: []
    },
    effects: {
        async preserve(params) {
            const response = await preserve(params)

            if (response.code === 200) {
                this.savePreserve({
                    data: response.data
                })
            }
        },
        // async exportPreserve(params) {
        //     const response = await exportPreserve(params)
        //
        //     if (response.code === 200) {
        //         this.saveRetainedSpread({
        //             retainedSpreadData: response.data
        //         })
        //     }
        // },
    },
    reducers: {
        savePreserve(state, paylode) {
            return {
                ...state,
                ...paylode
            }
        },
        // saveRetainedSpread(state, paylode) {
        //     return {
        //         ...state,
        //         ...paylode
        //     }
        // },
    }
}